package day27_ver2;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JLabel;

import java.awt.Label;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.util.HashMap;

public class material extends JFrame {
	
	static HashMap<String,material> map = new HashMap<String,material>();
	private String code;    // 품목 코드 
	private String codeName; // 품목명
	private int price; // 단가
	private String spec;// 제품 사양
	private String customer;// 거래처
	private int importEa;// 입고수량
	private int exportEa;// 출고수량
	
	
	public material(String code, String codeName, int price, String spec, String customer ,int importEa ,int exportEa){
		this.code = code;
		this.codeName = codeName;
		this.spec = spec;
		this.customer= customer;
		this.importEa= importEa;
		this.exportEa= exportEa;
	}	
		
	
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getCodeName() {
		return codeName;
	}

	public void setCodeName(String codeName) {
		this.codeName = codeName;
	}

	public int getPrice() {
		return price;
	}

	public void setPrice(int price) {
		this.price = price;
	}

	public String getSpec() {
		return spec;
	}

	public void setSpec(String spec) {
		this.spec = spec;
	}

	public String getCustomer() {
		return customer;
	}

	public void setCustomer(String customer) {
		this.customer = customer;
	}

	public int getImportEa() {
		return importEa;
	}

	public void setImportEa(int importEa) {
		this.importEa = importEa;
	}

	public int getExportEa() {
		return exportEa;
	}

	public void setExportEa(int exportEa) {
		this.exportEa = exportEa;
	}

	public JPanel getContentPane() {
		return contentPane;
	}

	public void setContentPane(JPanel contentPane) {
		this.contentPane = contentPane;
	}

	public Label getLabel() {
		return label;
	}

	private JPanel contentPane;
	private final Label label = new Label("작업중");

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					material frame = new material();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	
	
	
	
	public material() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		
		JMenuBar menuBar = new JMenuBar();
		setJMenuBar(menuBar);
		
		JMenu mnNewMenu = new JMenu("파일");
		menuBar.add(mnNewMenu);
		
		JMenuItem menuItem = new JMenuItem("조회");
		menuItem.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				getContentPane().removeAll();
				getContentPane().add(new MaterInputPanel());
				getContentPane().validate();
					
			}
		});
		mnNewMenu.add(menuItem);
		
		JMenuItem menuItem_1 = new JMenuItem("입,출고수량");
		menuItem_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				getContentPane().removeAll();
				getContentPane().add(new MasterSearchPanel());
				getContentPane().validate();
			
			
			}
		});
		mnNewMenu.add(menuItem_1);
		
		JMenuItem menuItem_2 = new JMenuItem("끝내기");
		menuItem_2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {// 이벤트 시작~
				material.this.dispose();   // 파일이름 this.dispose();를 한다면 파일끝내는 명령을 낼수 있다.
				
			}
		});
		mnNewMenu.add(menuItem_2);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
		
		JScrollPane scrollPane = new JScrollPane();
		contentPane.add(scrollPane, BorderLayout.CENTER);
		
		JTextArea textArea = new JTextArea();
		scrollPane.setViewportView(textArea);
		contentPane.add(label, BorderLayout.SOUTH);
	}

}
